Your code is correct:
import turtle
t = turtle.Pen()
Command line session:
% python3
Python 3.6.4 (v3.6.4:d48ecebad5, Dec 18 2017, 21:07:28)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import turtle
>>> t = turtle.Pen()
>>> exit()
%
Make sure you don't have a file of your own lying around named turtle.py
as this will interfere with loading Python's own turtle.py
library:
% touch turtle.py
% python3
Python 3.6.4 (v3.6.4:d48ecebad5, Dec 18 2017, 21:07:28)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import turtle
>>> t = turtle.Pen()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'turtle' has no attribute 'Pen'
>>>
Which generates the same "AttributeError: module 'turtle' has no attribute 'Pen'
" you received.